<?php
/**
 * @ClassName: OrderStatus
 * @Description: 订单状态枚举
 * @author: gydtrade
 * @Date: 2024-09-09 21:49
 * @Version: V1.0.0
 */

namespace app\common\enum;

class OrderStatus
{
    const INVALID = -1;
    const WAITCONFIRM = 0;
    const WAITSEND = 1;
    const WAITRECEIVE = 2;
    const WAITCCOMMENT = 3;
    const FINISH = 4;
    const CANCELLED = 5;

    /**
     * 发货订单状态 -1已作废 0待确认 1待发货 2待收货 3待评价 4已完成 5已取消
     * @param $level
     * @return mixed|string|string[]
     */
    public static function shopText($level)
    {
        $desc = [
            OrderStatus::INVALID => '已作废',
            OrderStatus::WAITCONFIRM => '待确认',
            OrderStatus::WAITSEND => '待发货',
            OrderStatus::WAITRECEIVE => '待收货',
            OrderStatus::WAITCCOMMENT => '待评价',
            OrderStatus::FINISH => '已完成',
            OrderStatus::CANCELLED => '已取消',
        ];
        if ($level === true) {
            return $desc;
        }
        return isset($desc[$level]) ? $desc[$level] : $level;
    }

    /**
     * 配送订单状态 -1已作废 0待确认 1待配送 2待收货 3待评价 4已完成 5已取消
     * @param $level
     * @return mixed|string|string[]
     */
    public static function waterText($level)
    {
        $desc = [
            OrderStatus::INVALID => '已作废',
            OrderStatus::WAITCONFIRM => '待确认',
            OrderStatus::WAITSEND => '待配送',
            OrderStatus::WAITRECEIVE => '待收货',
            OrderStatus::WAITCCOMMENT => '待评价',
            OrderStatus::FINISH => '已完成',
            OrderStatus::CANCELLED => '已取消',
        ];
        if ($level === true) {
            return $desc;
        }
        return isset($desc[$level]) ? $desc[$level] : $level;
    }

    /**
     * 酒店订单状态 -1已作废 0待确认 1待核销 2待核销 3待评价 4已完成 5已取消
     * @param $level
     * @return mixed|string|string[]
     */
    public static function hotelText($level)
    {
        $desc = [
            OrderStatus::INVALID => '已作废',
            OrderStatus::WAITCONFIRM => '待确认',
            OrderStatus::WAITSEND => '待核销',
            OrderStatus::WAITRECEIVE => '待核销',
            OrderStatus::WAITCCOMMENT => '待评价',
            OrderStatus::FINISH => '已完成',
            OrderStatus::CANCELLED => '已取消',
        ];
        if ($level === true) {
            return $desc;
        }
        return isset($desc[$level]) ? $desc[$level] : $level;
    }

}